﻿using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Utils;
using Utils.enums;

namespace BookM
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        LoginBLL loginBLL= new LoginBLL();

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Login_Click(object sender, EventArgs e)
        {
            //登录
            Loginsa();
        }

        /// <summary>
        /// 登录实现方法
        /// </summary>
        private void Loginsa()
        {
            string states = loginBLL.Login(new AdminInfo(txb_AdminID.Text, txb_AdminPWD.Text));
            if (String.Equals(states, EnumTools.GetDescription(LoginEnums.REGITER_STATES.SUCCEED)))
            {
                this.Hide();
                new HomePage().Show();
            }
            else
            {
                MessageBox.Show(states);
            }
        }
    }
}
